#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:pengfeifu
@file: cal_time.py 
@version:
@time: 2021/11/14 
@email:1324734112@qq.com
@desc： 装饰器，得到方法运行时间，类似java的aop
@function：常用函数
"""

import time


def cal_time(func):
    def wrapper(*args, **kwargs):
        t1 = time.time()
        result = func(*args, **kwargs)
        t2 = time.time()
        print(f"{func.__name__},运行了{t2 - t1} 秒")
        return result

    return wrapper
